import axios from "axios";
const baseServe = vm.$myConfig.ip;
const baseServeOld = vm.$myConfig.baseIp;

function commonAjax(urls,type,data,callback,anync){
    let handleType="GET";
    if(type.toUpperCase()=="POST"){
        handleType="POST";
    }
    if(anync){
        anync=false;
    }else{
        anync=true;
    }
    console.log("request==>"+`${urls}`)
    vm.$commonAjax(handleType,urls,data,callback,function(edata){
        console.log("返回失败！"+`${urls}`)
        console.log(edata)
        vm.promptDiagram.show=false;
      },function(comdata){
        vm.$vux.loading.hide()
        vm.promptDiagram.show=false;
      },anync)
}


//获取最新疫情的列表详情
export function queryNum(data,callback) {
  let url = `count`
  let urls = `${baseServe}${url}`;
  urls=urls;
  commonAjax(urls,"GET",data,callback);
}
//获取最新疫情的列表详情
export function queryNewList(data,callback) {
  let url = `article/list`
  let urls = `${baseServe}${url}`;
  urls=urls;
  commonAjax(urls,"GET",data,callback);
}

// 调查问卷
export function questionnaireData(data,callback) {
  let url = `app/data`
  let baseServes = `http://39.105.209.108:3030/`
  let urls = `${baseServes}${url}`;
  commonAjax(urls,"POST",JSON.stringify(data),callback);
}
// home轮播
export function swiperAjaxData(data,callback) {
  let url = `app/find`
  let baseServes = `http://183.95.190.8:3645/`
  let urls = `${baseServes}${url}`;
  commonAjax(urls,"GET",{},callback);
}
//获取所有企业list
export function queryEnterpriseList(data,callback) {
  let url = `api/v1/enterprises/info/search`
  let baseServes = `http://116.62.205.14:30051/`
  let urls = `${baseServes}${url}`;
  commonAjax(urls,"POST",JSON.stringify(data),callback);
}

export function queryListFordaily(data,callback) {
  let url = `api/search`
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"POST",JSON.stringify(data),callback);
}

// simpleReport 简单接口上报
export function simpleReport(data,callback) {
  let url = `/api/simple/report`
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"POST",JSON.stringify(data),callback);
}
//基础数据级联菜单多级
export function queryCityData(data,callback) {

  let url = `api/dist/${data.parentCode}`
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"GET",{},callback);
}
//基础数据级联菜单三级
export function queryCityDataForTwo(data,callback) {
  let url = `api/city/tree`
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"GET",{},callback);
}
//查询所有医院信息
export function queryHospitalForDistict(data,callback) {
  let url = `/api/hospital`
  // let baseServes = `http://39.105.209.108:8090/`
  let urls = `${url}/${data.code}`;
  commonAjax(urls,"GET",{},callback);
}
//查询所有物资
export function queryMaterial(data,callback) {
  let url = `/api/dict/materail`
  if(data.type=="all"){
     url = `/api/dict/materail/all`
  }
  // let baseServes = `http://39.105.209.108:8090/`
  // let urls = `${baseServes}${url}`;
  commonAjax(url,"GET",{},callback);
}

//医院医护人员上报页面
export function requestEnterpriseData(data, callback) {
      let url = `/api/enterprise/report`
  //     let baseServes = `http://39.105.209.108:8090/`
  //     let urls = `${baseServes}${url}`;
      commonAjax(url, "POST", JSON.stringify(data), callback);
  }
//医院医护人员上报页面
export function needStaffSubmit(data, callback) {
      let url = `/api/hospital/staff/report`
  //     let baseServes = `http://39.105.209.108:8090/`
  //     let urls = `${baseServes}${url}`;
      commonAjax(url, "POST", JSON.stringify(data), callback);
  }
//医院物资需求上报页面
export function needMaterialSubmit(data, callback) {
      let url = `api/hospital/demand/report`
  //     let baseServes = `http://39.105.209.108:8090/`
  //     let urls = `${baseServes}${url}`;
      commonAjax(url, "POST", JSON.stringify(data), callback);
  }
// 新增调查问卷
export function newquestionnaireData(data, callback) {
      let url = `api/report`
  //     let baseServes = `http://39.105.209.108:8090/`
  //     let urls = `${baseServes}${url}`;
      commonAjax(url, "POST", JSON.stringify(data), callback);
  }
  //常德个人信息上报
  export function cdquestionnaireData(data, callback) {
        let url = `/api/changde/report`
    //     let baseServes = `http://39.105.209.108:8090/`
    //     let urls = `${baseServes}${url}`;
        commonAjax(url, "POST", JSON.stringify(data), callback);
    }
  //查询常德小区
export function queryCdcommunity(data,callback) {
  let url = `http://116.62.205.14:30032/OdataService.svc/DataSourceEntity`;
  let urls = `${url}${data.code}`;
  commonAjax(urls,"GET",{},callback);
}
//查询常德小区下拉
  export function queryCdcommunityList(data,callback) {
    let url = `http://116.62.205.14:30032/OdataService.svc/DSourceDataEntity`;
    let urls = `${url}${data.code}`;
    commonAjax(urls,"GET",{},callback);
  }
//医院床位上报
export function needEnterBedNum(data, callback) {
      let url = `api/hospital/bed/report`
  //     let baseServes = `http://39.105.209.108:8090/`
  //     let urls = `${baseServes}${url}`;
      commonAjax(url, "POST", JSON.stringify(data), callback);
  }
// 企业（实创）
  export function realGenData(data, callback) {
        let url = `/api/enterprise/report`
    //     let baseServes = `http://39.105.209.108:8090/`
    //     let urls = `${baseServes}${url}`;
        commonAjax(url, "POST", JSON.stringify(data), callback);
    }


